<?php

include_once 'model/movie.php';

$conn = mysql_connect('localhost','root','');
if(!$conn){
    die('Could not connect..');
}
mysql_select_db('dbtraining',$conn);

$start = ($_REQUEST['start'] != '') ? $_REQUEST['start'] : 0;
$limit = ($_REQUEST['limit'] != '') ? $_REQUEST['limit'] : 5 ;

$total = count(Movie::loads());
echo "{success:true,total:".$total.",rows:".Movie::loadsPagingToJSON($start,$limit)."}";

mysql_close($conn);

?>
